package com.jiyun.purse.mapper;

import com.jiyun.pojo.order.OrderList;
import com.jiyun.pojo.purse.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderMapper {

    @Select("select \n" +
            "oi.*,\n" +
            "ot.order_time orderTime,\n" +
            "da.driver_name driverName,\n" +
            "da.driver_imgurl driverImgurl,\n" +
            "da.driver_point driverPoint,\n" +
            "ca.car_number carNumber,\n" +
            "ca.car_color carColor,\n" +
            "ca.car_name carName,\n" +
            "oi.close_cause closeCause,\n" +
            "oc.passenger_total passengerTotal\n" +
            "from order_information oi \n" +
            "left join order_time ot on oi.order_id = ot.order_id \n" +
            "LEFT JOIN driver_attribute da on oi.driver_id = da.order_id\n" +
            "LEFT JOIN car_attribute ca on ca.did = da.id\n" +
            "LEFT JOIN order_cost oc on oc.order_id = oi.order_id\n" +
            "where user_id = #{userId}")
    List<OrderList> findOrder(String userId);

    @Select("select fare_phone from user_personal where id = #{userId}")
    User findUser(Integer userId);
}